package ru.compft.web;

import org.apache.commons.io.output.CountingOutputStream;

import javax.servlet.ServletOutputStream;
import java.io.IOException;

/**
 * User: ASUS
 * Date: 24.08.2011
 * Time: 0:02:55
 * Выходной поток сервлета
 */
public class CountingServletOutputStream extends ServletOutputStream {
    private final CountingOutputStream output;

    public CountingServletOutputStream(ServletOutputStream output) {
        this.output = new CountingOutputStream(output);
    }

    @Override
    public void write(int b) throws IOException {
        output.write(b);
    }

    @Override
    public void flush() throws IOException {
        output.flush();
    }

    public int getByteCount() {
        return output.getCount();
    }
}
